﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CY.Utility.Common
{
    public static class DateTimeUtility
    {
        public static string GetTimeSpanString(DateTime startTime, DateTime endTime)
        {
            TimeSpan ts = endTime - startTime;

            if (ts.Days > 0)
            {
                return ts.Days + "天";
            }

            if (ts.Hours > 0)
            {
                return ts.Hours + "小时";
            }

            if (ts.Minutes > 0)
            {
                return ts.Minutes + "分钟";
            }

            return ts.Seconds + "秒";
        }
    }
}
